<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class template crc_basic</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../crc/reference.html#doxygen.crc_8hpp" title="Header &lt;boost/crc.hpp&gt;">
<link rel="prev" href="../crc/reference.html" title="Reference">
<link rel="next" href="classboost_1_1crc__optimal.html" title="Class template crc_optimal">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../crc/reference.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../crc/reference.html#doxygen.crc_8hpp"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="classboost_1_1crc__optimal.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="doxygen.classboost_1_1crc__basic"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template crc_basic</span></h2>
<p>boost::crc_basic — Bit-wise CRC computer. </p>
</div>
<h2 class="refsynopsisdiv-title">Synopsis</h2>
<div class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../crc/reference.html#doxygen.crc_8hpp" title="Header &lt;boost/crc.hpp&gt;">boost/crc.hpp</a>&gt;

</span><span class="keyword">template</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> Bits<span class="special">&gt;</span> 
<span class="keyword">class</span> <a class="link" href="classboost_1_1crc__basic.html" title="Class template crc_basic">crc_basic</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basictypes">types</a></span>
  <span class="keyword">typedef</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span> <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a3c28566ce96e59e20d91136008cae26c"><span class="identifier">value_type</span></a><span class="special">;</span>

  <span class="comment">// <a class="link" href="classboost_1_1crc__basic.html#id-1_3_10_11_1_4_1_6-bb">public member functions</a></span>
  <span class="keyword">explicit</span> <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a9cae2e76fcd50193af8fffd4b43abd12"><span class="identifier">crc_basic</span></a><span class="special">(</span><span class="identifier">value_type</span><span class="special">,</span> <span class="identifier">value_type</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">value_type</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">,</span> 
                     <span class="keyword">bool</span> <span class="special">=</span> <span class="keyword">false</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">value_type</span> <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a666ae27413ed3077f529a0948fad796b"><span class="identifier">get_truncated_polynominal</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">value_type</span> <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a387b8efecc4c589825f12e2d1130755a"><span class="identifier">get_initial_remainder</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">value_type</span> <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1aeb89c90899b568b4e19592a655379b89"><span class="identifier">get_final_xor_value</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a1193dbf1f8f6ba48dea4abc2394a292c"><span class="identifier">get_reflect_input</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a8a8b9417cb0012c0d86baab4a45f79dc"><span class="identifier">get_reflect_remainder</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">value_type</span> <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a8e18d95f606bbce83960dd1921a61499"><span class="identifier">get_interim_remainder</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1ae1e2f7d2e67b2b8a944db06f57aafb96"><span class="identifier">reset</span></a><span class="special">(</span><span class="identifier">value_type</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1aefbd1069b4231de1409fc2d89103db7f"><span class="identifier">reset</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a1f4f4b5c43131d9ba244087dd47fc454"><span class="identifier">process_bit</span></a><span class="special">(</span><span class="keyword">bool</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1ab44a8ec101bf5683b6067518642abf50"><span class="identifier">process_bits</span></a><span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">char</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a8b58f66aa6b73bd844c9a26e04802cca"><span class="identifier">process_byte</span></a><span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">char</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1aa3638d0043a80cf4ab9a31e4bf37edc5"><span class="identifier">process_block</span></a><span class="special">(</span><span class="keyword">void</span> <span class="keyword">const</span> <span class="special">*</span><span class="special">,</span> <span class="keyword">void</span> <span class="keyword">const</span> <span class="special">*</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a8c303374e0b96947b973a5dd140d525d"><span class="identifier">process_bytes</span></a><span class="special">(</span><span class="keyword">void</span> <span class="keyword">const</span> <span class="special">*</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">value_type</span> <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a16783e806c56bf0903c13278dfd309e1"><span class="identifier">checksum</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

  <span class="comment">// public data members</span>
  <span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">bit_count</span><span class="special">;</span>  <span class="comment">// A copy of <span class="emphasis"><em>Bits</em></span> provided for meta-programming purposes. </span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="id-1.3.10.11.2.7.4"></a><h2>Description</h2>
<p>Objects of this type compute the CRC checksum of submitted data, where said data can be entered piecemeal through several different kinds of groupings. Modulo-2 polynomial division steps are always performed bit-wise, without the use of pre-computation tables. Said division uses the altered algorithm, so any data has to be unaugmented.</p>
<p>

</p>
<div class="refsect2">
<a name="id-1.3.10.11.2.7.4.4"></a><h3>Template Parameters</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> Bits</pre>
<p>The order of the modulo-2 polynomial divisor. (<span class="emphasis"><em>Width</em></span> from the RMCA) </p>
</li></ol></div>
</div>
<div class="refsect2">
<a name="id-1.3.10.11.2.7.4.5"></a><h3>
<a name="doxygen.classboost_1_1crc__basictypes"></a><code class="computeroutput">crc_basic</code> 
        public
       types</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>
<span class="keyword">typedef</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span> <a name="doxygen.classboost_1_1crc__basic_1a3c28566ce96e59e20d91136008cae26c"></a><span class="identifier">value_type</span><span class="special">;</span></p>
<p>This type is used for CRC calculations and is the type for any returned checksums and returned or submitted remainders, (truncated) divisors, or XOR masks. It is a built-in unsigned integer type. </p>
</li></ol></div>
</div>
<div class="refsect2">
<a name="id-1.3.10.11.2.7.4.6"></a><h3>
<a name="id-1_3_10_11_1_4_1_6-bb"></a><code class="computeroutput">crc_basic</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">explicit</span> <a name="doxygen.classboost_1_1crc__basic_1a9cae2e76fcd50193af8fffd4b43abd12"></a><span class="identifier">crc_basic</span><span class="special">(</span><span class="identifier">value_type</span> truncated_polynomial<span class="special">,</span> 
                   <span class="identifier">value_type</span> initial_remainder <span class="special">=</span> <span class="number">0</span><span class="special">,</span> 
                   <span class="identifier">value_type</span> final_xor_value <span class="special">=</span> <span class="number">0</span><span class="special">,</span> 
                   <span class="keyword">bool</span> reflect_input <span class="special">=</span> <span class="keyword">false</span><span class="special">,</span> 
                   <span class="keyword">bool</span> reflect_remainder <span class="special">=</span> <span class="keyword">false</span><span class="special">)</span><span class="special">;</span></pre>Create a computer, separately listing each needed parameter. <p>Constructs a <code class="computeroutput"><a class="link" href="classboost_1_1crc__basic.html" title="Class template crc_basic">crc_basic</a></code> object with at least the required parameters to a particular CRC formula to be processed upon receiving input.</p>
<p>







</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">truncated_polynomial</code></span></p></td>
<td><p>The lowest coefficients of the divisor polynomial. The highest-order coefficient is omitted and always assumed to be 1. (<span class="emphasis"><em>Poly</em></span> from the RMCA) </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">initial_remainder</code></span></p></td>
<td><p>The (unaugmented) initial state of the polynomial remainder. Defaults to <code class="computeroutput">0</code> if omitted. (<span class="emphasis"><em>Init</em></span> from the RMCA) </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">final_xor_value</code></span></p></td>
<td><p>The (XOR) bit-mask to be applied to the output remainder, after possible reflection but before returning. Defaults to <code class="computeroutput">0</code> (i.e. no bit changes) if omitted. (<span class="emphasis"><em>XorOut</em></span> from the RMCA) </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">reflect_input</code></span></p></td>
<td><p>If <code class="computeroutput">true</code>, input bytes are read lowest-order bit first, otherwise highest-order bit first. Defaults to <code class="computeroutput">false</code> if omitted. (<span class="emphasis"><em>RefIn</em></span> from the RMCA) </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">reflect_remainder</code></span></p></td>
<td><p>If <code class="computeroutput">true</code>, the output remainder is reflected before the XOR-mask. Defaults to <code class="computeroutput">false</code> if omitted. (<span class="emphasis"><em>RefOut</em></span> from the RMCA)</p></td>
</tr>
</tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput"><span class="emphasis"><em>truncated_polynomial</em></span> == this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a666ae27413ed3077f529a0948fad796b">get_truncated_polynominal()</a></code> </p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput"><span class="emphasis"><em>initial_remainder</em></span> == this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a387b8efecc4c589825f12e2d1130755a">get_initial_remainder()</a></code> </p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput"><span class="emphasis"><em>final_xor_value</em></span> == this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1aeb89c90899b568b4e19592a655379b89">get_final_xor_value()</a></code> </p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput"><span class="emphasis"><em>reflect_input</em></span> == this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a1193dbf1f8f6ba48dea4abc2394a292c">get_reflect_input()</a></code> </p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput"><span class="emphasis"><em>reflect_remainder</em></span> == this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a8a8b9417cb0012c0d86baab4a45f79dc">get_reflect_remainder()</a></code> </p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput"><span class="emphasis"><em>initial_remainder</em></span> == this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a8e18d95f606bbce83960dd1921a61499">get_interim_remainder()</a></code> </p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput">(<span class="emphasis"><em>reflect_remainder</em></span> ? REFLECT(<span class="emphasis"><em>initial_remainder</em></span>) : <span class="emphasis"><em>initial_remainder</em></span>) ^ <span class="emphasis"><em>final_xor_value</em></span> == this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a16783e806c56bf0903c13278dfd309e1">checksum()</a></code> </p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">value_type</span> <a name="doxygen.classboost_1_1crc__basic_1a666ae27413ed3077f529a0948fad796b"></a><span class="identifier">get_truncated_polynominal</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Return the (truncated) polynomial divisor. <p>Returns a representation of the polynomial divisor. The value of the 2<sup>i</sup> bit is the value of the coefficient of the polynomial's x<sup>i</sup> term. The omitted bit for x<sup>(<a class="link" href="../">bit_count</a>)</sup> term is always 1.</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>The bit-packed list of coefficients. If the bit-length of <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a3c28566ce96e59e20d91136008cae26c">value_type</a> exceeds <a class="link" href="../">bit_count</a>, the values of higher-placed bits should be ignored (even any for x<sup>(<a class="link" href="../">bit_count</a>)</sup>) since they're unregulated. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">value_type</span> <a name="doxygen.classboost_1_1crc__basic_1a387b8efecc4c589825f12e2d1130755a"></a><span class="identifier">get_initial_remainder</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Return what the polynomial remainder was set to during construction. <p>Returns a representation of the polynomial remainder before any input has been submitted. The value of the 2<sup>i</sup> bit is the value of the coefficient of the polynomial's x<sup>i</sup> term.</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>The bit-packed list of coefficients. If the bit-length of <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a3c28566ce96e59e20d91136008cae26c">value_type</a> exceeds <a class="link" href="../">bit_count</a>, the values of higher-placed bits should be ignored since they're unregulated. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">value_type</span> <a name="doxygen.classboost_1_1crc__basic_1aeb89c90899b568b4e19592a655379b89"></a><span class="identifier">get_final_xor_value</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Return the XOR-mask used during output processing. <p>Returns the mask to be used during creation of a checksum. The mask is used for an exclusive-or (XOR) operation applied bit-wise to the interim remainder representation (after any reflection, if <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a8a8b9417cb0012c0d86baab4a45f79dc">get_reflect_remainder()</a> returns <code class="computeroutput">true</code>).</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>The bit-mask. If the bit-length of <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a3c28566ce96e59e20d91136008cae26c">value_type</a> exceeds <a class="link" href="../">bit_count</a>, the values of higher-placed bits should be ignored since they're unregulated. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="doxygen.classboost_1_1crc__basic_1a1193dbf1f8f6ba48dea4abc2394a292c"></a><span class="identifier">get_reflect_input</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Check if input-bytes will be reflected before processing. <p>Returns a whether or not a submitted byte will be "reflected" before it is used to update the interim remainder. Only the byte-wise operations <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a8b58f66aa6b73bd844c9a26e04802cca">process_byte</a>, <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1aa3638d0043a80cf4ab9a31e4bf37edc5">process_block</a>, and <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a8c303374e0b96947b973a5dd140d525d">process_bytes</a> are affected.</p>
<p>
</p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="doxygen.classboost_1_1crc__basic_1a8a8b9417cb0012c0d86baab4a45f79dc"></a><span class="identifier">get_reflect_remainder</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Check if the remainder will be reflected during output processing. <p>Indicates if the interim remainder will be "reflected" before it is passed to the XOR-mask stage when returning a checksum.</p>
<p>
</p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">value_type</span> <a name="doxygen.classboost_1_1crc__basic_1a8e18d95f606bbce83960dd1921a61499"></a><span class="identifier">get_interim_remainder</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Return the remainder based from already-processed bits. <p>Returns a representation of the polynomial remainder after all the input submissions since construction or the last <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1ae1e2f7d2e67b2b8a944db06f57aafb96">reset</a> call. The value of the 2<sup>i</sup> bit is the value of the coefficient of the polynomial's x<sup>i</sup> term. If CRC processing gets interrupted here, retain the value returned, and use it to start up the next CRC computer where you left off (with <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1ae1e2f7d2e67b2b8a944db06f57aafb96">reset(value_type)</a> or construction). The next computer has to have its other parameters compatible with this computer.</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>The bit-packed list of coefficients. If the bit-length of <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a3c28566ce96e59e20d91136008cae26c">value_type</a> exceeds <a class="link" href="../">bit_count</a>, the values of higher-placed bits should be ignored since they're unregulated. No output processing (reflection or XOR mask) has been applied to the value. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.classboost_1_1crc__basic_1ae1e2f7d2e67b2b8a944db06f57aafb96"></a><span class="identifier">reset</span><span class="special">(</span><span class="identifier">value_type</span> new_rem<span class="special">)</span><span class="special">;</span></pre>Change the interim remainder to a new value. <p>Changes the interim polynomial remainder to <span class="emphasis"><em>new_rem</em></span>, purging any influence previously submitted input has had. The value of the 2<sup>i</sup> bit is the value of the coefficient of the polynomial's x<sup>i</sup> term.</p>
<p>


</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">new_rem</code></span></p></td>
<td><p>The (unaugmented) state of the polynomial remainder starting from this point, with no output processing applied.</p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput"><span class="emphasis"><em>new_rem</em></span> == this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a8e18d95f606bbce83960dd1921a61499">get_interim_remainder()</a></code> </p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput">((this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a8a8b9417cb0012c0d86baab4a45f79dc">get_reflect_remainder()</a> ? REFLECT(<span class="emphasis"><em>new_rem</em></span>) : <span class="emphasis"><em>new_rem</em></span>) ^ this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1aeb89c90899b568b4e19592a655379b89">get_final_xor_value()</a>) == this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a16783e806c56bf0903c13278dfd309e1">checksum()</a></code> </p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.classboost_1_1crc__basic_1aefbd1069b4231de1409fc2d89103db7f"></a><span class="identifier">reset</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Change the interim remainder back to the initial value. <p>Changes the interim polynomial remainder to the initial remainder given during construction, purging any influence previously submitted input has had. The value of the 2<sup>i</sup> bit is the value of the coefficient of the polynomial's x<sup>i</sup> term.</p>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput">this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a387b8efecc4c589825f12e2d1130755a">get_initial_remainder()</a> == this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a8e18d95f606bbce83960dd1921a61499">get_interim_remainder()</a></code> </p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput">((this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a8a8b9417cb0012c0d86baab4a45f79dc">get_reflect_remainder()</a> ? REFLECT(this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a387b8efecc4c589825f12e2d1130755a">get_initial_remainder()</a>) : this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a387b8efecc4c589825f12e2d1130755a">get_initial_remainder()</a>) ^ this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1aeb89c90899b568b4e19592a655379b89">get_final_xor_value()</a>) == this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a16783e806c56bf0903c13278dfd309e1">checksum()</a></code> </p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.classboost_1_1crc__basic_1a1f4f4b5c43131d9ba244087dd47fc454"></a><span class="identifier">process_bit</span><span class="special">(</span><span class="keyword">bool</span> bit<span class="special">)</span><span class="special">;</span></pre>Submit a single bit for input processing. <p>Updates the interim remainder with a single altered-CRC-division step.</p>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">bit</code></span></p></td>
<td><p>The new input bit.</p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p>The interim remainder is updated though a modulo-2 polynomial division, where the division steps are altered for unaugmented CRCs. </p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.classboost_1_1crc__basic_1ab44a8ec101bf5683b6067518642abf50"></a><span class="identifier">process_bits</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">char</span> bits<span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> bit_length<span class="special">)</span><span class="special">;</span></pre>Submit the lowest <span class="emphasis"><em>bit_length</em></span> bits of a byte for input processing. <p>Updates the interim remainder with several altered-CRC-division steps. Each bit is processed separately, starting from the one at the 2<sup><span class="emphasis"><em>bit_length</em></span> - 1</sup> place, then proceeding down to the lowest-placed bit. Any order imposed by <code class="computeroutput">this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a1193dbf1f8f6ba48dea4abc2394a292c">get_reflect_input()</a></code> is ignored.</p>
<p>


</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">bits</code></span></p></td>
<td><p>The byte containing the new input bits. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">bit_length</code></span></p></td>
<td><p>The number of bits in the byte to be read.</p></td>
</tr>
</tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p>0 &lt; <span class="emphasis"><em>bit_length</em></span> &lt;= <code class="computeroutput">CHAR_BIT</code> </p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p>The interim remainder is updated though <span class="emphasis"><em>bit_length</em></span> modulo-2 polynomial divisions, where the division steps are altered for unaugmented CRCs. </p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.classboost_1_1crc__basic_1a8b58f66aa6b73bd844c9a26e04802cca"></a><span class="identifier">process_byte</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">char</span> byte<span class="special">)</span><span class="special">;</span></pre>Submit a single byte for input processing. <p>Updates the interim remainder with a byte's worth of altered-CRC-division steps. The bits within the byte are processed from the highest place down if <code class="computeroutput">this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a1193dbf1f8f6ba48dea4abc2394a292c">get_reflect_input()</a></code> is <code class="computeroutput">false</code>, and lowest place up otherwise.</p>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">byte</code></span></p></td>
<td><p>The new input byte.</p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p>The interim remainder is updated though <code class="computeroutput">CHAR_BIT</code> modulo-2 polynomial divisions, where the division steps are altered for unaugmented CRCs. </p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.classboost_1_1crc__basic_1aa3638d0043a80cf4ab9a31e4bf37edc5"></a><span class="identifier">process_block</span><span class="special">(</span><span class="keyword">void</span> <span class="keyword">const</span> <span class="special">*</span> bytes_begin<span class="special">,</span> <span class="keyword">void</span> <span class="keyword">const</span> <span class="special">*</span> bytes_end<span class="special">)</span><span class="special">;</span></pre>Submit a memory block for input processing, iterator-pair style. <p>Updates the interim remainder with several bytes' worth of altered-CRC-division steps. The bits within each byte are processed from the highest place down if <code class="computeroutput">this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a1193dbf1f8f6ba48dea4abc2394a292c">get_reflect_input()</a></code> is <code class="computeroutput">false</code>, and lowest place up otherwise. The bytes themselves are processed starting from the one pointed by <span class="emphasis"><em>bytes_begin</em></span> until <span class="emphasis"><em>bytes_end</em></span> is reached through forward iteration, treating the two pointers as if they point to <code class="computeroutput">unsigned char</code> objects.</p>
<p>




</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">bytes_begin</code></span></p></td>
<td><p>The address where the memory block begins. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">bytes_end</code></span></p></td>
<td><p>Points to one-byte past the address of the memory block's last byte, or <span class="emphasis"><em>bytes_begin</em></span> if no bytes are to be read.</p></td>
</tr>
</tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><span class="emphasis"><em>bytes_end</em></span> has to equal <span class="emphasis"><em>bytes_begin</em></span> if the latter is <code class="computeroutput">NULL</code> or otherwise doesn't point to a valid buffer. </p></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><span class="emphasis"><em>bytes_end</em></span>, if not equal to <span class="emphasis"><em>bytes_begin</em></span>, has to point within or one-byte-past the same buffer <span class="emphasis"><em>bytes_begin</em></span> points into. </p></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><span class="emphasis"><em>bytes_end</em></span> has to be reachable from <span class="emphasis"><em>bytes_begin</em></span> through a finite number of forward byte-pointer increments.</p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p>The interim remainder is updated though <code class="computeroutput">CHAR_BIT * (((unsigned char const *) bytes_end) - ((unsigned char const *) bytes_begin))</code> modulo-2 polynomial divisions, where the division steps are altered for unaugmented CRCs. </p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.classboost_1_1crc__basic_1a8c303374e0b96947b973a5dd140d525d"></a><span class="identifier">process_bytes</span><span class="special">(</span><span class="keyword">void</span> <span class="keyword">const</span> <span class="special">*</span> buffer<span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> byte_count<span class="special">)</span><span class="special">;</span></pre>Submit a memory block for input processing, pointer-and-size style. <p>Updates the interim remainder with several bytes' worth of altered-CRC-division steps. The bits within each byte are processed from the highest place down if <code class="computeroutput">this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a1193dbf1f8f6ba48dea4abc2394a292c">get_reflect_input()</a></code> is <code class="computeroutput">false</code>, and lowest place up otherwise. The bytes themselves are processed starting from the one pointed by <span class="emphasis"><em>buffer</em></span>, forward-iterated (as if the pointed-to objects were of <code class="computeroutput">unsigned char</code>) until <span class="emphasis"><em>byte_count</em></span> bytes are read.</p>
<p>



</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">buffer</code></span></p></td>
<td><p>The address where the memory block begins. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">byte_count</code></span></p></td>
<td><p>The number of bytes in the memory block.</p></td>
</tr>
</tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><span class="emphasis"><em>byte_count</em></span> has to equal 0 if <span class="emphasis"><em>buffer</em></span> is <code class="computeroutput">NULL</code> or otherwise doesn't point to valid memory. </p></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p>If <span class="emphasis"><em>buffer</em></span> points within valid memory, then that block has to have at least <span class="emphasis"><em>byte_count</em></span> more valid bytes allocated from that point.</p></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p>The interim remainder is updated though <code class="computeroutput">CHAR_BIT * <span class="emphasis"><em>byte_count</em></span></code> modulo-2 polynomial divisions, where the division steps are altered for unaugmented CRCs. </p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">value_type</span> <a name="doxygen.classboost_1_1crc__basic_1a16783e806c56bf0903c13278dfd309e1"></a><span class="identifier">checksum</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Return the checksum of the already-processed bits. <p>Computes the checksum of all the submitted bits since construction or the last call to <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1ae1e2f7d2e67b2b8a944db06f57aafb96">reset</a>. The checksum will be the raw checksum, i.e. the (interim) remainder after all the modulo-2 polynomial division, plus any output processing.</p>
<p>
</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>Since checksums are meant to be compared, any higher-placed bits (when the bit-length of <a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a3c28566ce96e59e20d91136008cae26c">value_type</a> exceeds <a class="link" href="../">bit_count</a>) will be set to 0. </p></td></tr>
</table></div>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p><code class="computeroutput">(this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a8a8b9417cb0012c0d86baab4a45f79dc">get_reflect_remainder()</a> ? REFLECT(this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a8e18d95f606bbce83960dd1921a61499">get_interim_remainder()</a>) : this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1a8e18d95f606bbce83960dd1921a61499">get_interim_remainder()</a>) ^ this-&gt;<a class="link" href="classboost_1_1crc__basic.html#doxygen.classboost_1_1crc__basic_1aeb89c90899b568b4e19592a655379b89">get_final_xor_value()</a></code></p></td>
</tr></tbody>
</table></div>
</li>
</ol></div>
</div>
</div>
</div>
<div class="copyright-footer">Copyright © 2001, 2003, 2012 Daryle Walker<p>
        Distributed under the Boost Software License, Version 1.0. (See the accompanying
        file LICENSE_1_0.txt or a copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../crc/reference.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../crc/reference.html#doxygen.crc_8hpp"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="classboost_1_1crc__optimal.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
